package com.chenfan.mcn.model.vo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import com.chenfan.mcn.enums.ArchivingStatusEnum;
import lombok.Data;

import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * @Author liuyang
 * @Date 2021/1/20
 * @Time 20:36
 * @Version V1.0
 **/
@Data
public class YearFrameVO {

    /**
     * id
     */
    private Long id;

    /**
     * 合同编号
     */
    @Excel(name = "合同编号", needMerge = true)
    private String yearFrameCode;

    /**
     * 合同类型名称
     */
    @Excel(name = "合同类型")
    private String contractTypeName;

    /**
     * 生效状态（0-生效中，1-未生效）
     */
    @Excel(name = "生效状态", replace = {"生效中_0", "未生效_1"}, needMerge = true)
    private Integer effectiveStatus;

    /**
     * 客户/红人名称
     */
    @Excel(name = "客户/红人名称", needMerge = true)
    private String customerName;

    /**
     * 客户id
     */
    private Long customerId;

    /**
     * 签约对象：1客户、2红人
     */
    private Integer targetType;

    /**
     * 折扣返点审批单号
     */
    @Excel(name = "折扣返点审批单号", needMerge = true)
    private String discountCode;

    /**
     * 单据状态(0_待提交、1_审批中、2_审批通过、3_审批拒绝、4_已撤回、5_已作废)
     */
    @Excel(name = "单据状态", replace = {"待提交_0", "审批中_1", "审批通过_2", "审批拒绝_3", "已撤回_4", "已作废_5"}, needMerge = true)
    private Integer yearStatus;

    /**
     * 审批状态
     */
    private Integer approvalStatus;

    /**
     * 流程节点名称
     */
    @Excel(name = "审批状态", needMerge = true)
    private String flowStatusName;


    /**
     * 我司合同主体
     */
    @Excel(name = "我司合同主体", needMerge = true)
    private String contractSubjectName;

    /**
     * 我司合同主体
     */
    private String contractSubject;

    /**
     * 合作开始时间
     */
    @Excel(name = "合作开始时间", format = "yyyy/MM/dd", needMerge = true)
    private Date startDate;

    /**
     * 合作结束时间
     */
    @Excel(name = "合作结束时间", format = "yyyy/MM/dd", needMerge = true)
    private Date endDate;

    /**
     * 归档状态
     */
    @Excel(name = "归档状态", replace = {"待盖章_0", "待归档_1", "已归档_2"})
    private Integer archivingStatus;

    /**
     * 归档编号
     */
    @Excel(name = "归档编号")
    private String archivingCode;

    /**
     * 备注
     */
    @Excel(name = "备注", needMerge = true)
    private String remark;

    /**
     * 创建人名称
     */
    @Excel(name = "创建人", needMerge = true)
    private String createName;

    /**
     * 创建时间
     */
    @Excel(name = "创建时间", needMerge = true, format = "yyyy/MM/dd")
    private Date createDate;

    @ExcelCollection(name = "年框合同补充协议")
    private List<ExportYearSupplementaryVO> exportYearSupplementaryVO;

    /**
     * 流程id
     */
    private Long flowId;

    /**
     * 合同类型
     */
    private String contractType;

    /**
     * 归档状态名称
     */
    private String archivingStatusName;

    public String getArchivingStatusName() {
        if (Objects.nonNull(getArchivingStatus())) {
            return ArchivingStatusEnum.getStatusName(getArchivingStatus());
        }
        return null;
    }
}
